home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / ADSPSecure.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  6KB  |  197 lines

  1. /*
  2.      File:        ADSPSecure.h
  3.  
  4.      Contains:    Secure AppleTalk Data Stream Protocol Interfaces.
  5.  
  6.      Version:    Technology:    AOCE Toolbox 1.02
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __ADSPSECURE__
  19. #define __ADSPSECURE__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __ADSP__
  25. #include <ADSP.h>
  26. #endif
  27. #ifndef __OCEAUTHDIR__
  28. #include <OCEAuthDir.h>
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if PRAGMA_IMPORT_SUPPORTED
  36. #pragma import on
  37. #endif
  38.  
  39. #if PRAGMA_ALIGN_SUPPORTED
  40. #pragma options align=mac68k
  41. #endif
  42.  
  43. #if FOR_SYSTEM7_ONLY
  44. /*
  45.  New ADSP control codes
  46.  
  47.  * open a secure connection 
  48. */
  49.  
  50. enum {
  51.     sdspOpen                    = 229
  52. };
  53.  
  54. /*
  55. For secure connections, the eom field of ioParams contains two single-bit flags
  56. (instead of a zero/non-zero byte). They are an encrypt flag (see below), and an
  57. eom flag.  All other bits in that field should be zero.
  58.  
  59. To write an encrypted message, you must set an encrypt bit in the eom field of
  60. the ioParams of your write call. Note: this flag is only checked on the first
  61. write of a message (the first write on a connection, or the first write following
  62. a write with eom set.
  63. */
  64.  
  65. enum {
  66.     dspEOMBit                    = 0,                            /* set if EOM at end of write */
  67.     dspEncryptBit                = 1                                /* set to encrypt message */
  68. };
  69.  
  70.  
  71. enum {
  72.     dspEOMMask                    = 1 << dspEOMBit,
  73.     dspEncryptMask                = 1 << dspEncryptBit
  74. };
  75.  
  76. /*
  77. Define an ADSPSecure parameter block, as used for the secure Open call.
  78.  
  79.  * size of ADSPSecure workspace 
  80. */
  81.  
  82. enum {
  83.     sdspWorkSize                = 2048
  84. };
  85.  
  86. struct TRSecureParams {
  87.     unsigned short                     localCID;                    /* local connection id */
  88.     unsigned short                     remoteCID;                    /* remote connection id */
  89.     AddrBlock                         remoteAddress;                /* address of remote end */
  90.     AddrBlock                         filterAddress;                /* address filter */
  91.     unsigned long                     sendSeq;                    /* local send sequence number */
  92.     unsigned short                     sendWindow;                    /* send window size */
  93.     unsigned long                     recvSeq;                    /* receive sequence number */
  94.     unsigned long                     attnSendSeq;                /* attention send sequence number */
  95.     unsigned long                     attnRecvSeq;                /* attention receive sequence number */
  96.     unsigned char                     ocMode;                        /* open connection mode */
  97.     unsigned char                     ocInterval;                    /* open connection request retry interval */
  98.     unsigned char                     ocMaximum;                    /* open connection request retry maximum */
  99.  
  100.     Boolean                         secure;                        /*  --> TRUE if session was authenticated */
  101.     AuthKeyPtr                         sessionKey;                    /* <--> encryption key for session */
  102.     unsigned long                     credentialsSize;            /*  --> length of credentials */
  103.     void *                            credentials;                /*  --> pointer to credentials */
  104.     void *                            workspace;                    /*  --> pointer to workspace for connection align on even boundary and length = sdspWorkSize */
  105.     AuthIdentity                     recipient;                    /*  --> identity of recipient (or initiator if active mode */
  106.     UTCTime                         issueTime;                    /*  --> when credentials were issued */
  107.     UTCTime                         expiry;                        /*  --> when credentials expiry */
  108.     RecordIDPtr                     initiator;                    /* <--  RecordID of initiator returned here. Must give appropriate Buffer to hold RecordID (Only for passive or accept mode) */
  109.     Boolean                         hasIntermediary;            /* <--  will be set if credentials has an intermediary */
  110.     Boolean                         filler1;
  111.     RecordIDPtr                     intermediary;                /* <--  RecordID of intermediary returned here. (If intermediary is found in credentials Must give appropriate Buffer to hold RecordID (Only for passive or accept mode) */
  112. };
  113. typedef struct TRSecureParams TRSecureParams;
  114.  
  115. typedef struct SDSPParamBlock SDSPParamBlock;
  116. typedef SDSPParamBlock *SDSPPBPtr;
  117. /*
  118.         This ProcPtr uses register based parameters on the 68k and cannot
  119.         be written in or called from a high-level language without the help of
  120.         mixed mode or assembly glue.
  121.  
  122.             typedef pascal void (*SDSPIOCompletionProcPtr)(SDSPPBPtr paramBlock);
  123.  
  124. */
  125.  
  126. #if GENERATINGCFM
  127. typedef UniversalProcPtr SDSPIOCompletionUPP;
  128. #else
  129. typedef Register68kProcPtr SDSPIOCompletionUPP;
  130. #endif
  131. struct SDSPParamBlock {
  132.     QElem *                            qLink;
  133.     short                             qType;
  134.     short                             ioTrap;
  135.     Ptr                             ioCmdAddr;
  136.     SDSPIOCompletionUPP             ioCompletion;
  137.     OSErr                             ioResult;
  138.     StringPtr                         ioNamePtr;
  139.     short                             ioVRefNum;
  140.     short                             ioCRefNum;                    /* adsp driver refNum */
  141.     short                             csCode;                        /* adsp driver control code */
  142.     long                             qStatus;                    /* adsp internal use */
  143.     short                             ccbRefNum;
  144.     union {
  145.         TRinitParams                     initParams;                /* dspInit, dspCLInit */
  146.         TRopenParams                     openParams;                /* dspOpen, dspCLListen, dspCLDeny */
  147.         TRcloseParams                     closeParams;            /*dspClose, dspRemove*/
  148.         TRioParams                         ioParams;                /*dspRead, dspWrite*/
  149.         TRattnParams                     attnParams;                /*dspAttention*/
  150.         TRstatusParams                     statusParams;            /*dspStatus*/
  151.         TRoptionParams                     optionParams;            /*dspOptions*/
  152.         TRnewcidParams                     newCIDParams;            /*dspNewCID*/
  153.         TRSecureParams                     secureParams;            /* dspOpenSecure */
  154.     }                                 u;
  155. };
  156.  
  157.  
  158. #if GENERATINGCFM
  159. #else
  160. #endif
  161.  
  162. enum {
  163.     uppSDSPIOCompletionProcInfo = kRegisterBased
  164.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA0, SIZE_CODE(sizeof(SDSPPBPtr)))
  165. };
  166.  
  167. #if GENERATINGCFM
  168. #define NewSDSPIOCompletionProc(userRoutine)        \
  169.         (SDSPIOCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSDSPIOCompletionProcInfo, GetCurrentArchitecture())
  170. #else
  171. #define NewSDSPIOCompletionProc(userRoutine)        \
  172.         ((SDSPIOCompletionUPP) (userRoutine))
  173. #endif
  174.  
  175. #if GENERATINGCFM
  176. #define CallSDSPIOCompletionProc(userRoutine, paramBlock)        \
  177.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppSDSPIOCompletionProcInfo, (paramBlock))
  178. #else
  179. /* (*SDSPIOCompletionUPP) cannot be called from a high-level language without the Mixed Mode Manager */
  180. #endif
  181. #endif
  182.  
  183. #if PRAGMA_ALIGN_SUPPORTED
  184. #pragma options align=reset
  185. #endif
  186.  
  187. #if PRAGMA_IMPORT_SUPPORTED
  188. #pragma import off
  189. #endif
  190.  
  191. #ifdef __cplusplus
  192. }
  193. #endif
  194.  
  195. #endif /* __ADSPSECURE__ */
  196.  
  197.